//    Copyright (C) Kherty.  All rights reserved.
namespace OpenLS.Spreadsheet.Expressions
{
    internal class RangeReferenceExpressionEvaluator: ExpressionArrayBase
    {
        private readonly RangeReferenceExpression _rangeReference;
        private readonly EvaluationContext _context;

        public RangeReferenceExpressionEvaluator(RangeReferenceExpression rangeReference, EvaluationContext context)
        {
            _rangeReference = rangeReference;
            _context = context;
        }

        Range range{get{ return _rangeReference.RangeReference.Offset(_context.Offset).Range;}}


        public override object this[int row, int column]
        {
            get { return range[row, column].Value; }
        }

        public override int RowCount
        {
            get { return range.RowSpan; }
        }

        public override int ColumnCount
        {
            get { return range.ColumnSpan; }
        }
    }
}